import * as vscode from 'vscode';

class QuickItem extends vscode.TreeItem {
  customChildren: QuickItem[] | undefined;

  constructor(label: string, command?: string, args?: any, collapsibleState?: vscode.TreeItemCollapsibleState, children?: QuickItem[]) {
    super(label, collapsibleState);
    if (command) {
      this.command = {
        title: label,
        command,
        arguments: args,
      };
    }
    this.customChildren = children;
  }
}

export default class QuickAccessTreeProvider {
  getChildren(element: QuickItem) {
    if (element && element.customChildren) {
      return element.customChildren;
    }

    return [
      new QuickItem(
        vscode.l10n.t('DevStar Home'),
        undefined,
        undefined,
        vscode.TreeItemCollapsibleState.Expanded,
        [new QuickItem(vscode.l10n.t('Open'), 'devstar.showHome')]
      ),
      new QuickItem(
        vscode.l10n.t('Miscellaneous'),
        undefined,
        undefined,
        vscode.TreeItemCollapsibleState.Expanded,
        // [new QuickItem('Connect Remote Container', 'devstar.connectRemoteContainer')]
        [new QuickItem(vscode.l10n.t('Clean'), 'devstar.clean')]
      ),
    ];
  }

  getTreeItem(element: QuickItem) {
    return element;
  }
}
